import tensorflow as tf

first_counter = tf.constant(0)
second_counter = tf.constant(10)


def cond(first_counter, second_counter, *args):
    return first_counter < second_counter


def body(first_counter, second_counter):
    first_counter = tf.add(first_counter, 2)
    second_counter = tf.add(second_counter, 1)
    return first_counter, second_counter


c1, c2 = tf.while_loop(cond, body, [first_counter, second_counter])

with tf.Session() as sess:
    counter_1_res, counter_2_res = sess.run([c1, c2])


print(counter_1_res)
print(counter_2_res)
